This invention relates to searching for contents on web pages. Web browsers that display web pages commonly support extensibility by allowing third-party plug-ins. One example of a plug-in is a toolbar. In general toolbars provide additional functionality, such as searching for and highlighting text on a web page, storing bookmarks for web pages, blocking unwanted web pages from being displayed, filling out web forms, and so on. One example of a toolbar is the Google Toolbar, which is provided by Google Inc. of Mountain View, Calif.
As is well known to those of ordinary skill in the art, typically, a web page is represented internally in a web browser as a DOM (Document Object Model) tree. The DOM tree corresponds to the structure of the web page as implied by the HTML (HyperText Markup Language) tags used in creating the web page, and allows various types of scripts and programming languages to modify the content and visual presentation of the web page in the browser. Typically, any text contained between two HTML tags is stored in a single node of the DOM tree. When a web page is loaded in a browser, the browser provides the corresponding DOM tree representation to the toolbar, which performs its operations on the DOM tree.
As was mentioned above, often browsers provide a search function that the plugins can use to search for a certain text segment, such as a word or phrase, on a web page. However, this function typically only finds text that is contained in a single DOM node. For example, assume that the HTML code specifies:                <p>This is an<b>important</b>thing.</p>        
The built-in search function in the web browser would find the phrase “is an” because this phrase is not broken by HTML tags. However, the search function would not find the phrase “an important thing,” because the phrase is broken by HTML tags indicating that the word “important” should be shown in bold font. Thus, there is a need to provide improved methods for text searching on web pages